var e = require;
var t = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var n = e("BaseModuleUI"),
    a = e("monster_node_info"),
    i = e("node_team"),
    r = e("role_node"),
    s = e("team_node_info"),
    l = e("tower_node_info"),
    c = cc._decorator,
    d = c.ccclass,
    h =
        (c.property,
        (function (e) {
            function t() {
                var t = (null !== e && e.apply(this, arguments)) || this;
                return (
                    (t.role_common_skill = null),
                    (t.role_skill_one = null),
                    (t.role_skill_two = null),
                    (t.role_info = null),
                    (t.ack_range = 0),
                    t
                );
            }
            return (
                __extends(t, e),
                (t.prototype.initView = function () {
                    this.role_info = this.node.getComponent(r.default);
                    for (var e = 0, t = this.node.getComponentsInChildren(cc.BoxCollider); e < t.length; e++) {
                        var o = t[e];
                        1 == o.tag &&
                            ((this.role_common_skill = o),
                            (o.enabled = !1),
                            (this.ack_range = 1.5 * Math.abs(o.offset.x))),
                            2 == o.tag && ((this.role_skill_one = o), (o.enabled = !1)),
                            3 == o.tag && ((this.role_skill_two = o), (o.enabled = !1));
                    }
                    -1 != [3, 4].indexOf(this.role_info.player_info.role_id) && (this.ack_range = 480);
                }),
                (t.prototype.roleCommonSkill = function (e, t) {
                    (this.role_common_skill.enabled = e && "attack" == t),
                        (this.role_skill_one.enabled = e && "attack_skill1" == t),
                        (this.role_skill_two.enabled = e && "attack_skill2" == t);
                }),
                (t.prototype.onCollisionEnter = function (e, t) {
                    var o = e.node,
                        n = o.group;
                    if (o.isValid && (1 == t.tag || 2 == t.tag || 3 == t.tag) && 0 == e.tag)
                        if ("soldier" == n) {
                            var c = o.getComponent(s.default);
                            c.team_info != this.node.getComponent(i.default).getTeamInfo() &&
                                c.soldierBeHit(
                                    this.role_info.getRoleSkillAttack(t.tag),
                                    this.role_info.match_game_index
                                );
                        } else if ("role" == n || "tower" == n) {
                            var d = o.getComponent(i.default).getTeamInfo(),
                                h = this.node.getComponent(i.default).getTeamInfo();
                            "C71" == this.role_info.C_ID && 3 == t.tag && "role" == n && d == h
                                ? o.getComponent(r.default).roleSkillAddHp(0.3)
                                : d != h
                                ? "role" == n
                                    ? (this.role_info.setForSpeed(o.getComponent(r.default).getEquipForSpeed()),
                                      o
                                          .getComponent(r.default)
                                          .roleBeHit(
                                              this.role_info.getRoleSkillAttack(t.tag),
                                              this.role_info.match_game_index
                                          ))
                                    : "tower" == n &&
                                      o
                                          .getComponent(l.default)
                                          .towerBeHit(
                                              this.role_info.getRoleSkillAttack(t.tag),
                                              this.role_info.match_game_index
                                          )
                                : "C96" == this.role_info.C_ID &&
                                  3 == t.tag &&
                                  "role" == n &&
                                  o.getComponent(r.default).roleSkillAddHp(0.2);
                        } else
                            "monster" == n &&
                                o
                                    .getComponent(a.default)
                                    .attackMonster(
                                        this.role_info.getRoleSkillAttack(t.tag),
                                        this.role_info.match_game_index,
                                        this.node
                                    );
                }),
                (t.prototype.onBeginContact = function (e, t, o) {
                    var n = o.node.group;
                    ("role" != n && "soldier" != n) || (e.disabled = !0);
                }),
                __decorate([d], t)
            );
        })(n.default));
o.default = h;
